﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NS_OpenApiV3;
using NS_SnsNetWork;
using NS_SnsSigCheck;
using NS_SnsStat;
using YXQ.Common.Helper;

namespace YXQ.Manager
{
    public partial class Test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //string appid = StringUtils.GetWebConfigValue("AppId");
            //string appkey = StringUtils.GetWebConfigValue("AppKey");
            //string server_name = StringUtils.GetWebConfigValue("Url");
            //string openid = "E098C1E975A2459E534B48FB3224CFB6";
            //string openkey = "A137906EE9DAFAAAA91C1D84F857FB38";
            //string pf = "qzone";
            //OpenApiV3 sdk = new OpenApiV3(appid, appkey);
            //sdk.SetServerName(server_name);
            //RstArray result = new RstArray();

            ////get_info接口
            //result = GetUserInfo(sdk, openid, openkey, pf);

            ////add_weibo接口
            //result = AddWeiboPic(sdk, openid, openkey, pf);
            //HttpContext.Current.Response.Write("<br>ret = " + result.Ret + "<br>msg = " + result.Msg);
        }
        RstArray GetUserInfo(OpenApiV3 sdk, string openid, string openkey, string pf)
    {
        Dictionary<string, string> param = new Dictionary<string, string>();
        param.Add("openid", openid);
        param.Add("openkey", openkey);
        param.Add("pf", pf);
        param.Add("userip","112.90.139.30");

        string script_name = "/v3/user/get_info";
        return sdk.Api(script_name, param);
    }

    RstArray AddWeiboPic(OpenApiV3 sdk, string openid, string openkey, string pf)
    {
        Dictionary<string, string> param = new Dictionary<string, string>();
        param.Add("openid", openid);
        param.Add("openkey", openkey);
        param.Add("pf", "tapp");
        param.Add("userip", "112.90.139.30");
        param.Add("content", "图片描述。。@xxx");

        //filename填写接口所要求的，和文件对应的参数名
        string filename = "pic";
        string filepath = "D:\\picture.jpg";
        string script_name = "/v3/t/add_pic_t";

        return sdk.ApiWithFile(script_name, param,filename, filepath);
    }
    }
}